<?php
#+------------------------------------------------------------------
#| 普通的。
#+------------------------------------------------------------------
#| Author:Janmas Cromwell <janmas-cromwell@outlook.com>
#+------------------------------------------------------------------
namespace form\element\traits;

trait Js
{
    protected $js = '';

    protected $loadJs = [];

    public function js(string $jsLogic)
    {
        $this->js = $jsLogic;
        return $this;
    }

    public function loadJs($script)
    {
        $this->loadJs = is_array($script) ? $script : [$script];
        return $this;
    }

    /**
     * @return string
     */
    public function getJs(): string
    {
        return $this->js;
    }

    /**
     * @return array
     */
    public function getLoadJs(): array
    {
        return $this->loadJs;
    }
}